home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / editor / frexxed / fpl / precompile.fpl < prev    next >
Text File  |  1995-07-18  |  2KB  |  56 lines

  1. int SearchCountA(string searchstring)
  2. {
  3.   int foundcount=0;
  4.   GotoLine(1, 0);
  5.   while (Search(searchstring)>=0)
  6.     foundcount++;
  7.   return(foundcount);
  8. }
  9.  
  10. export int PreCompile()
  11. {
  12.   int BufferID=DuplicateEntry();
  13.   int currentbuffer=GetBufferID();
  14.   int foundcount1, foundcount2;
  15.   string result="";
  16.  
  17.   if (BufferID) {
  18.     Status(0, "Wait...");
  19.     CurrentBuffer(BufferID);
  20.  
  21.     foundcount1=SearchCountA("\"");
  22.     result=joinstr("'\"' is found ", ltostr(foundcount1), " times!  ");
  23.     if (foundcount1 & 1)
  24.       result=joinstr(result, "Not good!");
  25.     else
  26.       result=joinstr(result, "Good!");
  27.     foundcount1=SearchCountA("{");
  28.     result=joinstr(result, "\n'{' is found ", ltostr(foundcount1), " times!  ");
  29.     foundcount2=SearchCountA("}");
  30.     result=joinstr(result, "\n'}' is found ", ltostr(foundcount2), " times!  ");
  31.     if (foundcount1!=foundcount2)
  32.       result=joinstr(result, "Not good!");
  33.     else
  34.       result=joinstr(result, "Good!");
  35.  
  36.     foundcount1=SearchCountA("(");
  37.     result=joinstr(result, "\n'(' is found ", ltostr(foundcount1), " times!  ");
  38.     foundcount2=SearchCountA(")");
  39.     result=joinstr(result, "\n')' is found ", ltostr(foundcount2), " times!  ");
  40.     if (foundcount1!=foundcount2)
  41.       result=joinstr(result, "Not good!");
  42.     else
  43.       result=joinstr(result, "Good!");
  44.  
  45.     CurrentBuffer(currentbuffer);
  46.     Kill(BufferID);
  47.     Status();
  48.     Request(result, "PreCompile", "Yeah!");
  49.   }
  50. }
  51.  
  52. /* Assign "amiga control shift p" to the function */
  53.  
  54. AssignKey("PreCompile();", "amiga control shift p");
  55.  
  56.